﻿@{
    ViewBag.Title = "网站设置";
}
@model MvcApplication.Entity.SiteInfo

<div class="am-cf am-padding">
    <div class="am-fl am-cf">
        <strong class="am-text-primary am-text-lg">设置</strong> / 
        <small>Setting</small>
    </div>
</div>
<div class="am-g">
    <form class="am-form" id="siteInfo">
        <div class="am-g am-margin-top">

            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    网站标题
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                    <input type="text" class="am-input-sm" name="Name" value="@Model.Name" >
                </div>
            </div>

            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    网站子标题
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                    <input type="text" class="am-input-sm" name="SubName" value="@Model.SubName" >
                </div>
            </div>

            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    关键字
                </div>
                <div class="am-u-sm-8 am-u-md-4">
                    <input type="text" class="am-input-sm" name="KeyWord" value="@Model.KeyWord">
                </div>
                <div class="am-u-sm-12 am-u-md-6">多个关键字用半角逗号隔开</div>
            </div>

            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-12 am-u-md-2 am-text-right admin-form-text">
                    网站描述
                </div>
                <div class="am-u-sm-12 am-u-md-10">
                    <textarea name="Description" rows="10" placeholder="">@Model.Description</textarea>
                </div>
            </div>

            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-12 am-u-md-2 am-text-right admin-form-text">
                    统计代码
                </div>
                <div class="am-u-sm-12 am-u-md-10">
                    <textarea name="AccessStatisticsCode" rows="10" placeholder="">@Model.AccessStatisticsCode</textarea>
                </div>
            </div>


            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    &nbsp;
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                    <button id="submitBtn" type="button" 
                        data-am-loading="{spinner: 'circle-o-notch', loadingText: '保存中...', resetText: '加载过了'}"
                        class="am-btn am-btn-primary am-btn-xs">提交保存</button>
                </div>
            </div>
        </div>
    </form>
</div>
@section scripts{
    <script>
        $('#submitBtn').click(function () {
            var values = $('#siteInfo').serializeArray();
            $.post('/site/refresh', values).success(function () {
                layer.msg('保存成功');
                location.reload();
            }).error(function () {
                layer.msg('服务器异常');
            });
        });
    </script>
}
